package com.chefu.common.controller;


import com.chefu.common.pojo.CfException;
import com.chefu.common.pojo.ExceptionResult;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;


@ControllerAdvice
public class CfExceptionController {

    @ExceptionHandler(CfException.class)
    @ResponseBody
    public ResponseEntity<ExceptionResult> handlerException(CfException e){
        return ResponseEntity.status(e.getStatus()).body(new ExceptionResult(e));
    }
}
